package com.gsit.expenditure.utils;

import java.util.concurrent.atomic.AtomicInteger;

public class InvoiceNumberGenerator {

	private AtomicInteger atomicInteger;
	private static InvoiceNumberGenerator obj = null;

	private InvoiceNumberGenerator(int initialValue) {
		this.atomicInteger = new AtomicInteger(initialValue);
	}

	public static InvoiceNumberGenerator getInstance() {
		if (obj == null) {
			obj = new InvoiceNumberGenerator(1);
		}
		return obj;
	}

	public int getCounter() {
		return atomicInteger.getAndIncrement();
	}

}
